#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long LONG;

void Extended_Euclid(LONG A, LONG B, LONG& X, LONG& Y, LONG& D) {
	X=0, Y=1, D = B;
	LONG u=1, v=0, m, n, q, r;
	while (A!=0) {
		q=D/A;
	   	r=D%A;
		m=X-u*q;
	   	n=Y-v*q;
		D=A; A=r; X=u; Y=v; u=m; v=n;
	}
}

/* main
 *  * */
int main() {
	std::ios_base::sync_with_stdio (true);
	LONG A, B, D, X, Y;
	cin >> A >> B;
	do {
		Extended_Euclid(A, B, X, Y, D);
		cout << X << " "<< Y << " " << D << endl;
		cin >> A >> B;
	} while(cin.eof() == false);
	return 0;
}
